//
//  Image.swift
//  iOSProjectExtensionSwift
//
//  Created by HBGG on 2020/8/31.
//  Copyright © 2020 lidianchao. All rights reserved.
//

import UIKit
extension UIImage {
    static func imageWithColor(color:UIColor) ->UIImage {
        let rect = CGRect(x: 0, y: 0, width: 1, height: 1)
        UIGraphicsBeginImageContext(rect.size)
        let context:CGContext = UIGraphicsGetCurrentContext()!
        context.setFillColor(color.cgColor);
        context.fill(rect);
        
        let image = UIGraphicsGetImageFromCurrentImageContext()
        UIGraphicsEndImageContext()
        
        return image!
    }
}
